<?php
/**
 * Created By base
 * Author: Virus
 * Date: 2020/3/27
 * Time: 15:44
 */

namespace app\admin\controller;

use app\common\model\mysql\AdminLog as AdminLogModel;
use think\Log;

class AdminLog extends Base
{
    /**
     * 管理员日志列表
     * @return \think\response\View
     */
    public function index()
    {
        try {
            $lists = AdminLogModel::with(
                [
                    'admin' => function ($query) {
                        $query->field('username');
                    },
                ]
            )
                ->order('id', 'desc')
                ->paginate(10);
        } catch (\Exception $e) {
            Log::write($e->getMessage(), 'info');
            $lists = [];
        }

        return view('admin_log/index', compact('lists'));
    }
}